package com.gao.tcp;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",8899);
         InputStream inputStream = socket.getInputStream();
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("小马".getBytes());
        byte[] bytes = new byte[1024];
        int read = inputStream.read(bytes);
        String msg = new String(bytes, 0, read);
        System.out.println(msg);
        socket.close();
    }

}
